package com.example.demo3.web;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.demo3.entity.User;
import com.example.demo3.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RestController
public class UserController {

    @Resource
    private UserService userService;

    @GetMapping("list")
    public Page<User> list(@RequestParam(defaultValue = "1") Long current, @RequestParam(defaultValue = "10") Long size) {
        log.info("current:[{}], size:[{}]", current, size);
        return userService.page(Page.of(current, size));
    }
}
